<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="请输入1-100之间的整数">
<input type="button" value="猜一猜" onclick="f()">
<div></div>
<script>
  let i=parseInt(Math.random()*100)+1;
  let i1= document.querySelector("input");
  let i2= document.querySelector("div");
  let count=0;
   function f(){
     count++;
     if(i1.value>i){
       i2.innerText="太大了"

     }else if(i1.value<i){
       i2.innerText="太小了"

     }else{
       i2.innerText="恭喜你第"+count+"次猜对了"
       let i=parseInt(Math.random()*100)+1;
       count=0;
     }
     i.value="";
     console.log(i)
   }


</script>

</body>
</html>